package com.agiantii.ablog.handler.article.filter.impl;

import com.agiantii.ablog.handler.article.filter.ContentFilter;
import com.agiantii.ablog.pojo.dto.PostDTO;
import org.springframework.stereotype.Component;
import java.util.Arrays;
import java.util.List;

@Component
public class SensitiveWordFilter implements ContentFilter {
    private static final List<String> SENSITIVE_WORDS = Arrays.asList("傻", "笨蛋", "白痴", "asshole");
    
    @Override
    public void doFilter(PostDTO content) {
        String text = content.getTitle() + content.getContent();
        for (String word : SENSITIVE_WORDS) {
            if (text.contains(word)) {
                throw new IllegalArgumentException("内容包含敏感词：" + word);
            }
        }
    }
} 